app.controller("search", function ($http, $scope, $locale) {


    $scope.searchvars = sessionStorage.getItem("search");

    $scope.booklists = [];
    $http({
        method: 'POST',
        url: app.url + '/Book/search?search=' + $scope.searchvars,
        data: {"search": $scope.searchvars}
    }).then(function (res) {

        if (res.data.length!=0) {
            $scope.booklists = res.data;
            console.log(res.data);
        } else {
            $("#modal-191634").click();
            $('.modal-title').html("没有相关信息");
            $('.modal-body').html("未找到您要的的相关信息,请检查您的信息是否填写有误");
        }
    }, function () {
        $("#modal-191634").click();
        $('.modal-title').html("登录失败");
        $('.modal-body').html("服务器响应超时");
    });

$scope.searchpost=function () {
        console.log($scope.searchvars);
    sessionStorage.setItem("search",$scope.searchvars);
    $http({
        method: 'POST',
        url: app.url + '/Book/search?search=' + $scope.searchvars,
        data: {"search": $scope.searchvars}
    }).then(function (res) {

        if (res.data.length!=0) {
            $scope.booklists = res.data;
            console.log(res.data);
        } else {
            $("#modal-191634").click();
            $('.modal-title').html("没有相关信息");
            $('.modal-body').html("未找到您要的的相关信息,请检查您的信息是否填写有误");
        }
    }, function () {
        $("#modal-191634").click();
        $('.modal-title').html("登录失败");
        $('.modal-body').html("服务器响应超时");
    })
}
});